package cn.lxb.web.starter.template.autoconfigure.jackson.deserializer;

import cn.lxb.web.starter.template.helper.TimeHelper;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;

import java.io.IOException;
import java.util.Date;

/**
 * 日期反序列化处理
 *
 * @author 54lxb
 * @since 2019-11-20
 */
public class DateDeserializer extends JsonDeserializer<Date> {

    @Override
    public Date deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
        return TimeHelper.parse(jp.getValueAsString());
    }
}
